/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kreig133.analytic.classes;

import com.kreig133.analytic.interfaces.ViewDataHandler;
import java.util.Collections;
import java.util.Map;

/**
 *
 * @author C.C.-fag
 */
public class SimpleScaleHandler implements ViewDataHandler{

    ViewDataHandler previous;

    public SimpleScaleHandler(ViewDataHandler previous) {
        this.previous = previous;
    }
    
    
    public Map<Double, Double> getProcessedData() throws Exception {
        Map<Double, Double> result = previous.getProcessedData();
        
        Double  max = Collections.max(result.values());
        double koeff = 100.0/max;
        for(Double key : result.keySet()){
            result.put(key, result.get(key)*koeff);
        }
        return result;
        
    }

}
